package org.example.service.impl;

import org.example.mapper.LoveDiaryMapper;
import org.example.pojo.LoveDiary;
import org.example.service.LoveDiaryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class LoveDiaryServiceImpl implements LoveDiaryService {

    @Autowired
    private LoveDiaryMapper loveDiaryMapper;

    @Override
    public void add(String title, String content, String mood, Integer userId, String url) {
        loveDiaryMapper.add(title, content, mood, userId, url);
    }

    @Override
    public void addPhoto(Integer id, String url) {
        loveDiaryMapper.addPhoto(id, url);
    }

    @Override
    public List<LoveDiary> list(Integer userId) {
        return loveDiaryMapper.list(userId);
    }

    @Override
    public void editLaveDiary(String id, String title, String content, String mood, String url) {
        loveDiaryMapper.editLaveDiary(id, title, content, mood, url);
    }

    @Override
    public void delete(String id) {
        loveDiaryMapper.deleteByPrimaryKey(Long.valueOf(id));
    }


}
